package com.co.recommend.dao;

import com.co.video.pojo.VideoState;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import javax.persistence.FieldResult;
import javax.persistence.SqlResultSetMapping;
import java.util.List;


/**
 * @author ldl.plus
 * @date 2020年06月22日  0:41
 */
@Repository
public interface VideoStateMapper extends Mapper<VideoState> {
    /**
     * 更具权重顺序加载精选video
     * @param w_view 观看次数权重
     * @param w_favo 搜藏权重
     * @param w_like 点赞权重
     * @param num   前num条
     * @return
     */
    @Select("SELECT * FROM `tv_videoState` ORDER BY (#{w_view}*view+#{w_favo}*favorite+#{w_like}*likes) DESC LIMIT #{num}")
    public List<VideoState> loadVideoState(int w_view,int w_favo,int w_like,int num);

    /**
     * 更具权重加载流行视频
     * @param w_favo 收藏
     * @param w_nowrank 现在排行
     * @param w_share  点赞
     * @param num
     * @return
     */
    @Select("SELECT * FROM `tv_videoState` ORDER BY (#{w_favo}*favorite+#{w_nowrank}*now_rank+#{w_share}*share) DESC LIMIT #{num}")
    public List<VideoState> loadPoupVideoState(int w_favo,int w_nowrank,int w_share,int num);
}
